
/**
 * Convertit un Element <form> en Object
 */
$.fn.serializeObject = function()
{

    var original = {};
    var a = this.serializeArray();
    $.each(a, function() {
		var o = original;
		var name = this.name;
		var multiple = false;
		if (name.substr(-2) == "[]") {
			name = name.substring(0, name.length-2);
			multiple = true;
		}
		if (name.indexOf("[") >= 0) {
			var names = name.replace(']', '').split('[');
			for (var i = 0; i < names.length-1; i++) {
				if (i < names.length-1 && o[names[i]] === undefined) {
					o[names[i]] = {};
				}
				o = o[names[i]];
			}
			name = names.pop();
		}
		if (multiple && o[name] === undefined) {
			o[name] = [];
		}
        if (o[name] !== undefined) {
            if (!o[name].push) {
                o[name] = [o[name]];
            }
            o[name].push(this.value || '');
        } else {
            o[name] = this.value || '';
        }
    });
    return original;
};